String? _toChinese(int weekday) {
  Map<int, String> mp = {
    1: '周一',
    2: '周二',
    3: '周三',
    4: '周四',
    5: '周五',
    6: '周六',
    7: '周日',
  };
  return mp[weekday];
}

String formatTime(int time) {
  if (time == 0) {
    return "";
  }
  var t = DateTime.fromMillisecondsSinceEpoch(time);
  var now = DateTime.now();
  if (now.day == t.day) {
    return '${t.hour}:${t.minute}';
  } else if (now.day - t.day == 1) {
    return '昨天';
  } else if (now.difference(t).inDays <= 7) {
    var str = _toChinese(t.weekday);
    return str == null ? '' : str;
  } else {
    return '${t.month}月${t.day}';
  }
}
